################################
# DESCRIPTIVE STATISTICS TABLE #
################################

# Author: Kasia Nalewajko
# First created:
# Replicated: 12 June 2024

rm(list = ls())

# LOAD PACKAGES -----------------------------------------------------------

if (!require("dplyr")) install.packages("dplyr")
if (!require("stargazer")) install.packages("stargazer")

# LOAD DATA ---------------------------------------------------------------

load("./00 SUBMITTED/00 APSR final/04 replication_files/01 data/main.Rda")

# CLEAN ----------

# choose variables to summarise
temp <- main %>% 
  dplyr::select(all_jewish_victims, 
                klarsfeld_deported_sum, 
                maitron_shot, 
                FFIFFCgentile,
                FFIFFCall,
                mpf_sum, 
                months_Verdun_Petain, 
                pop1936, 
                allocated_jpop, 
                nsynagogues, 
                catholic_churches, 
                DHI_milipol_sum1942, 
                collabos_antijew, 
                ActionFrancaise_19_pct, 
                FRANCISTE_36_1_pct, 
                turnout_36_1_pct, 
                empty_ballots_36_1_pct, 
                nuance_extremegauche_36_1_pct, 
                nuance_gauche_36_1_pct, 
                nuance_centregauche_36_1_pct, 
                nuance_centredroit_36_1_pct, 
                nuance_droite_36_1_pct, 
                nuance_extremedroite_36_1_pct, 
                nuance_divers_36_1_pct)

temp$dept_code <- NULL
temp <- as.data.frame(temp)

# EXPORT ---------

stargazer(temp, 
          type = "latex", 
          title="Descriptive statistics of the main variables used in the analyses", 
          min.max=TRUE, 
          mean.sd = TRUE, 
          nobs = TRUE, 
          median = TRUE, 
          digits=1, 
          align=T,
          covariate.labels = c("All Jewish victims", 
                               "Deported Jews", 
                               "Murdered Jews", 
                               "FFI and FFC insurgents (gentile)", 
                               "FFI and FFC insurgents (gentile and Jews)", 
                               "WWI milit. deaths", 
                               "Months Vérdun Pétain", 
                               "1936 population", 
                               "1941 Jewish population", 
                               "Synagogues", 
                               "Catholic churches", 
                               "1942 state presence", 
                               "Collaborators", 
                               "Action Française vote 1919", 
                               "Franciste vote 1936", 
                               "Turnout 1936", 
                               "Empty ballots 1936", 
                               "Extreme-left votes 1936", 
                               "Left votes 1936", 
                               "Centre-left votes 1936", 
                               "Centre-right votes 1936", 
                               "Right votes 1936", 
                               "Extreme-right votes 1936", 
                               "Other votes 1936")
)
